package com.atguigu.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.atguigu.base.BaseDAO;
import com.atguigu.base.BaseService;
import com.atguigu.base.BaseServiceImpl;
import com.atguigu.dao.HouseBrokerDAO;
import com.atguigu.entity.HouseBroker;
import com.atguigu.service.HouseBrokerService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @PACKAGE_NAME: com.atguigu.service.impl
 * @CLASSNAME: HouseBrokerServiceImpl
 * @AUTHOR: zhangsan
 * @DATE: 2024/4/23 16:11
 * @SINCE 17.0.7
 * @DESCRIPTION: HouseBrokerServiceImpl
 */
@Service(interfaceClass = HouseBrokerService.class)
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class HouseBrokerServiceImpl extends BaseServiceImpl<HouseBroker> implements HouseBrokerService {
    @Resource
    private HouseBrokerDAO houseBrokerDAO;
    @Override
    protected BaseDAO<HouseBroker> getEntityDAO() {
        return houseBrokerDAO;
    }

    /**
     * 通过房源id查找经纪人集合，查找负载该房屋的经纪人集合
     *
     * @param houseId
     * @return
     */
    @Override
    public List<HouseBroker> findListByHouseId(Long houseId) {
        List<HouseBroker> houseBrokerList = houseBrokerDAO.findListByHouseId(houseId);
        return houseBrokerList;
    }
}
